
<{include file="www/header.tpl"}>
<{include file="www/header-base.tpl"}>

<div class="top-banner">
    <img class="img" src="/resource/www/imgs/search_track.jpg">
    <p class="info">寻找你感兴趣的路线</p>
    <div class="content-search">
        <div class="search-form" style="width:778px;">    
          <div class="city">
          <span class="text"><{if $scity}><{$scity}><{else}>目的地<{/if}></span>
          <div class='city-wrap' style="display:none;">
             <ul class="country-box">
                <{foreach from=$cityList item=citys name=countryBox key=country}>
                <{if $smarty.foreach.countryBox.index==0}>     
                <li country="<{$country}>" class="active"><{$country}></li>
                <{else}>
                <li country="<{$country}>"><{$country}></li>
                <{/if}>
                <{/foreach}>
             </ul>
             
             <{foreach from=$cityList item=citys name=cityBox key=country}>
             <div class='city-item' country='<{$country}>' 
             <{if $smarty.foreach.cityBox.index==0}>
             <{else}>     
             style="display:none;"
             <{/if}>
             >
             <{foreach from=$citys item=city key=cityId}>
             <a href='javascript:void(0);' data='<{$cityId}>' country='<{$country}>'><{$city}></a>
             <{/foreach}>
             </div>
             <{/foreach}>
             
             <input type=hidden name='city' value='<{$scityId}>'>  
          </div>
          </div>

            <input class="go-date" type="text" name="start" id="start" placeholder="出发日期" value='<{$sstart}>'>
            <input class="back-date" type="text" name="end" id="end" placeholder="返回日期" value='<{$sstop}>'>
            <select class="number" name="number" id="number">
                <{section name=loop loop=15}>
                    <option  value="<{$smarty.section.loop.index+1}>"
                    <{if $snum==$smarty.section.loop.index+1}>selected<{/if}> >
                     <{$smarty.section.loop.index+1}>位游客
                    </option>
                <{/section}>
            </select>
            <span class="search-btn">搜索</span>
          </div>
     </div>
</div>

<div class="center-main fix" style="position:relative;">
    <div class="sidebar">
             <div class="condition">
                <p class="title" onclick="menu_func(this);">
                    <i class="up-down"></i>
                    玩法类型
                </p>
                <ul class="ul" style="display:none;">
                    <li class="li">
                        <label class="fix">
                            <em class="left all"></em>
                            <span class="center">全部</span>
                            <input class="right" type="radio"  name="type" value="0" id="">
                        </label>
                    </li>
                    <{foreach from=$lineTypeList item=t }>
                    <li class="li">
                        <label class="fix">
                            <em class="left"></em>
                            <span class="center"><{$t.name}></span>
                            <input class="right" type="radio" <{if $lineType==$t.id}>checked<{/if}> name="type" value="<{$t.id}>" id="">
                        </label>
                    </li>
                    <{/foreach}>
                </ul>
            </div>
             <div class="condition">
                <p class="title" onclick="menu_func(this);">
                    <i class="icon-down"></i>
                    玩伴年龄
                </p>
                <ul class="ul">
                    <li class="li">
                        <label class="fix">
                            <em class="left all"></em>
                            <span class="center">全部</span>
                            <input class="right" type="radio"  name="age" value="-1" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left"></em>
                            <span class="center">70后</span>
                            <input class="right" type="radio"  name="age" value="70" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left"></em>
                            <span class="center">80后</span>
                            <input class="right" type="radio"  name="age" value="80" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left"></em>
                            <span class="center">90后</span>
                            <input class="right" type="radio"  name="age" value="90" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left"></em>
                            <span class="center">00后</span>
                            <input class="right" type="radio"  name="age" value="00" id="">
                        </label>
                    </li>
                </ul>
            </div>
            <div class="condition">
                <p class="title" onclick="menu_func(this);">
                    <i class="icon-down"></i>
                    玩伴性别
                </p>
                <ul class="ul">
                    <li class="li">
                        <label class="fix">
                            <em class="left all"></em>
                            <span class="center">全部</span>
                            <input class="right" type="radio" name="gender"  value="0" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left boy"></em>
                            <span class="center">男生</span>
                            <input class="right" type="radio" name="gender"  value="m" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left girl"></em>
                            <span class="center">女生</span>
                            <input class="right" type="radio" name="gender" value="f" id="">
                        </label>
                    </li>
                </ul>
            </div>
            <div class="condition">
                <p class="title" onclick="menu_func(this);">
                    <i class="icon-down"></i>
                    玩伴身份
                </p>
                <ul class="ul">
                    <li class="li">
                        <label class="fix">
                            <em class="left all"></em>
                            <span class="center">全部</span>
                            <input class="right" type="radio" name="identity" value="0" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left lxs"></em>
                            <span class="center">留学生</span>
                            <input class="right" type="radio" name="identity" value="留学生" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left china"></em>
                            <span class="center">当地华人</span>
                            <input class="right" type="radio" name="identity" value="当地华人" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left wgr"></em>
                            <span class="center">外国人</span>
                            <input class="right" type="radio" name="identity" value="外国人" id="">
                        </label>
                    </li>
                </ul>
            </div>
            <div class="condition">
                <p class="title" onclick="menu_func(this);">
                    <i class="icon-down"></i>
                    玩伴语言
                </p>
                <ul class="ul">
                    <li class="li">
                        <label class="fix">
                            <em class="left all"></em>
                            <span class="center">全部</span>
                            <input class="right" type="radio" name="language" value="0" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left cn"></em>
                            <span class="center">普通话</span>
                            <input class="right" type="radio" name="language" value="1" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left uk"></em>
                            <span class="center">英语</span>
                            <input class="right" type="radio" name="language" value="3" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left fr"></em>
                            <span class="center">法语</span>
                            <input class="right" type="radio" name="language" value="2" id="">
                        </label>
                    </li>
                </ul>
            </div>
            <div class="condition">
                <p class="title" onclick="menu_func(this);">
                    <i class="icon-down"></i>
                    出行方式
                </p>
                <ul class="ul">
                    <li class="li">
                        <label class="fix">
                            <em class="left all"></em>
                            <span class="center">自由选择</span>
                            <input class="right" type="radio" name="chuxing" value="0" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left pt"></em>
                            <span class="center">私家车</span>
                            <input class="right" type="radio" name="chuxing" value="1" id="">
                        </label>
                    </li>
                    <li class="li">
                        <label class="fix">
                            <em class="left car"></em>
                            <span class="center">公共交通</span>
                            <input class="right" type="radio" name="chuxing" value="2"  id="">
                        </label>
                    </li>
                </ul>
            </div> 
            <div class="customize fix">
                <div class="left">
                    <img class="img" src="/resource/www/imgs/customize_help.png" alt="">
                </div>
                <div class="right">
                    <a target="_blank" href="/customize/" class="go-click">
                    <p class="title">哇吖定制服务</p>
                    没有找到合适的路线？请点击 &gt;</a>
                </div>
            </div>
            <input type='hidden' name='page' value=1>

    </div>
    
    <div class="loader-skin">
    <img src="/resource/www/imgs/ajax-loader-blue.gif">
    </div>
    
    <div class="content">
     <div class="info-bar fix">
            <div class="jieguo">已为您搜索到<em id='counts'></em>条热门线路</div>
            <div id="price" class="sort-item">
                 <span class='text'>价格</span>
                 <ul class="menu">
                 <li class="high2low">从高到低</li>
                 <li class="low2high">从低到高</li>
                 </ul>
                 <input type="hidden" name="price" value="0">
            </div>
            <div id="orders" class="sort-item">
                 <span class='text'>成单数</span>
                 <ul class="menu">
                 <li class="high2low">从高到低</li>
                 <li class="low2high">从低到高</li>
                 </ul>
                 <input type="hidden" name="orders" value="0">
            </div>
            <div id="score" class="sort-item">
                 <span class='text'>评分</span>
                 <ul class="menu">
                 <li class="high2low">从高到低</li>
                 <li class="low2high">从低到高</li>
                 </ul>
                 <input type="hidden" name="score" value="0">
            </div>
      </div>
      
      <div class='info-box'></div>
      
    </div>
</div>
<script type="text/javascript">
            var contentsearchOY = $("div.content-search").offset().top;
$(window).scroll(function(){
            var contentsearchY=contentsearchOY-$(document).scrollTop();
            if(contentsearchY<=0){
            $("div.content-search").removeAttr("style");
            $("div.content-search").css({"position":"fixed","top":0,"left":0});
            }else if(contentsearchY>0){
            $("div.content-search").removeAttr("style");
            $("div.content-search").css({"position":"absolute","bottom":0,"left":0});
            }
});
</script>
<script>
    $(function(){
        $("input[type='radio']").click(function() {
            $("input[name='page']").val(1);
            search_condition();
        });
        //城市选择
        $(".city .text").click(function(e){
            e.stopPropagation();
            $('.city-wrap').toggle();
        });
        $('.country-box li').click(function(e){
        	e.stopPropagation();
            $('.country-box li').removeClass('active'); 
            $(this).addClass('active');
            $('.city-item').hide();
            var country=$(this).attr('country');
            $('.city-item[country='+country+']').show();
        })
        $('.city-wrap .city-item a').click(function(){
        	var id=$(this).attr('data');
        	var city=$(this).html();
        	$("input[name='city']").val(id);
        	$('.city-wrap').hide();
        	$('.city .text').html(city)
        });
        
        $(".search-btn").click(function() {
            $("input[name='page']").val(1);
            search_condition();
        }); 
        
        //排序按钮
        $('.info-bar .sort-item .text').click(function(e){
            e.stopPropagation();
            var id=$(this).parent().attr('id');
            $(".info-bar .sort-item:not('#"+id+"')").find('.menu').hide();
            $(this).parent().find('.menu').toggle();
        });
        //点击其他地方隐藏
        $(document).click(function() {
	        $('.info-bar .sort-item .menu').hide();
            $('.city-wrap').hide();
        });
        $('.info-bar .menu .high2low').click(function() {
            $('.info-bar input').val(0);
            $('.info-bar .sort-item').removeClass('h2l-active l2h-active');
            var item=$(this).parent().parent();
            item.find('input').val(1);
            item.addClass('h2l-active');
            $("input[name='page']").val(1);
            search_condition();
        });
        
        $('.info-bar .menu .low2high').click(function() {
            $('.info-bar input').val(0);
            $('.info-bar .sort-item').removeClass('h2l-active l2h-active');
            var item=$(this).parent().parent();
            item.find('input').val(2);
            item.addClass('l2h-active');
            $("input[name='page']").val(1);
            search_condition();
        });

        search_condition();
    });
</script>

<script>
function backToPos()
{
	$("html,body").animate({scrollTop:'145px'},800);
}

function search_condition(){
	//加载层
	backToPos();
	$(".loader-skin").show();
	
    var type=$("input[name='type']:checked").val();
    var age = $("input[name='age']:checked").val();
    var gender = $("input[name='gender']:checked").val();
    var identity = $("input[name='identity']:checked").val();
    var language = $("input[name='language']:checked").val();
    var chuxing = $("input[name='chuxing']:checked").val();
    var city = $("input[name='city']").val();
    var start = $("#start").val();
    var end = $("#end").val();
    var number = $("#number").val();
    var price = $("input[name='price']").val();
    var orders = $("input[name='orders']").val();
    var score = $("input[name='score']").val();
    var page = $("input[name='page']").val()
 
    $.get('/line/search',{type:type,age:age,gender:gender,identity:identity,language:language,chuxing:chuxing,city:city,start:start,end:end,number:number,price:price,orders:orders,score:score,page:page},function(o){
            	if(o.status==1){
            		$('.center-main .content .info-box').html(o.content);
            		$(".loader-skin").hide();
            	}else{layer.msg('请求出错，请重试')}
    },'json');

}
function changePage(page){
    $("input[name='page']").val(page);
    search_condition();
}
function menu_func(item) {

    if ($(item).parent().find('.ul').is(":hidden")) {
        $(item).find('i').removeClass('up-down').addClass('icon-down');
    } else {
        $(item).find('i').removeClass('icon-down').addClass('up-down');
    }
    $(item).parent().find('.ul').slideToggle();
}

</script>

<{include file="www/widget_calendar.tpl"}>
<{include file="www/footer.tpl"}>
